﻿using System;
using System.Globalization;
using System.Windows.Data;
using CardPlay.Model.Primitives;

namespace CardPlay.Client.Converters
{
    public class EnumToDescriptionNameConvereter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var source = value as Enum;
            return source != null && targetType == typeof(string) ? source.ToLocalizedString() : null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}